#include <iostream>
#include <sys/eventfd.h>
#include <unistd.h>
#include <cstdint>

int main()
{
    int efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
    if (efd < 0)
    {
        std::cerr << "eventfd create error" << std::endl;
    }

    uint64_t val = 1;
    write(efd, &val, sizeof(val));
    write(efd, &val, sizeof(val));
    write(efd, &val, sizeof(val));

    uint64_t res;
    int ret = read(efd, &res, sizeof(res));
    if (ret < 0)
    {
        std::cerr << "read failed" << std::endl;
    }
    std::cout << res << std::endl;
    return 0;
}